function PhoneNumberInput() {
const [value, setValue] = useState()
const handleChange = (e) => {
const { value } = e.target;
let curr = value.replace(/\D/g, "");
if (curr.length > 6) {
curr = `${curr.slice(0,6)}-${curr.slice(6)}`
}
if (curr.length > 3) {
curr = `(${curr.slice(0, 3)})${curr.slice(3)}`
}
setValue(curr)
}
return (
<div>
<label for="phone-input"> Phone Number Input Field: </label>
<div>
<input id="phone-input" value = {value} onChange = {handleChange} />
</div>
</div>
)
}